<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ page import="java.io.*,java.util.*,java.sql.*" %>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<html>
<head>
    <meta charset="utf-8">
    <title>同学录</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        .fakeimg {
            height: 200px;
            background: #aaa;
        }

        td, th {
            text-align: center;
        }

        a {
            text-decoration: none
        }
    </style>
</head>
<body>
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/servlet?useUnicode=true&characterEncoding=utf-8"
                   user="root" password="root"/>

<sql:query dataSource="${snapshot}" var="result">
    SELECT * from t_info;
</sql:query>
<!-- 头部开始 -->
<div class="jumbotron text-center" style="margin-bottom:0">
    <h1>同学录</h1>
</div>
<nav class="navbar navbar-inverse">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand">计科1班 </a>
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
            <ul class="nav navbar-nav" style="width: 85%;">
                <li class="active"><a href="./index.jsp">主页</a></li>
                <li><a href="./add.jsp">添加新同学</a></li>
                <li><a href="./edit.jsp">修改同学信息</a></li>
                <li class="navbar-right"><a href="./login.jsp">登录</a></li>
                <li class="navbar-right"><a href="./sign.jsp">注册</a></li>
            </ul>
        </div>
    </div>
</nav>
<!-- 头部结束 -->

<div class="container">
    <h1 style="text-align: center; margin-bottom: 50px;">学生信息展示</h1>

    <div style="float: left;">
        <form class="form-inline">
            <div class="form-group">
                <label for="exampleInputName2">姓名</label>
                <input type="text" class="form-control" id="exampleInputName2" placeholder="">
            </div>
            <div class="form-group">
                <label for="address">籍贯</label>
                <input type="text" class="form-control" id="address" placeholder="湖北">
            </div>
            <div class="form-group">
                <label for="exampleInputEmail2">邮箱</label>
                <input type="email" class="form-control" id="exampleInputEmail2" placeholder="">
            </div>
            <button type="submit" class="btn btn-default">查找</button>
        </form>
    </div>

    <div class="bs-example" data-example-id="hoverable-table">
        <table class="table table-hover">
            <thead>
            <tr>
                <th>学号</th>
                <th>姓名</th>
                <th>性别</th>
                <th>年龄</th>
                <th>籍贯</th>
                <th>QQ</th>
                <th>邮箱</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="row" items="${result.rows}">
                <tr>
                    <td><c:out value="${row.StudentNumber}"/></td>
                    <td><c:out value="${row.fullName}"/></td>
                    <td><c:out value="${row.Gender}"/></td>
                    <td><c:out value="${row.Age}"/></td>
                    <td><c:out value="${row.NativePlace}"/></td>
                    <td><c:out value="${row.QQ}"/></td>
                    <td><c:out value="${row.mailbox}"/></td>
                    <td>
                        <button type="button" class="btn btn-warning">
                            <a href="./edit.jsp?StudentNumber=${row.StudentNumber}&fullName=${row.fullName}
&Gender=${row.Gender}&Age=${row.Age}&NativePlace=${row.NativePlace}&QQ=${row.QQ}&mailbox=${row.mailbox}">修改</a>
                        </button>
                        <button type="button" class="btn btn-danger?">
                            <a href="./index_del.jsp?StudentNumber=${row.StudentNumber}">删除</a>
                        </button>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <nav aria-label="Page navigation">
        <ul class="pagination">
            <li>
                <a href="#" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <li><a href="#">1</a></li>
            <li><a href="#">2</a></li>
            <li><a href="#">3</a></li>
            <li><a href="#">4</a></li>
            <li><a href="#">5</a></li>
            <li>
                <a href="#" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <span style="font-size: 20px; margin-left: 10px;">共 16 条数据 共10页</span>
        </ul>
    </nav>
</div>


<div class="jumbotron text-center" style="margin-bottom:0">
    <p>@梅文超 2020-5-20</p>
</div>


</body>
</html>